<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.cmccsi.mapper.UserMapper">
	
	<!-- 保存 -->
	<insert id="save" parameterType="user">
		insert into user(id,name,age,username,password) values(#{id},#{name},#{age},#{username},#{password})
	</insert>
	
	<!-- 更新 -->
	<update id="update" parameterType="user">
		update user set name=#{name},password=#{password} where id=#{id}
	</update>
	
	<!-- 查找 -->
	<select id="find" parameterType="int" resultType="user">
		select * from user where id=#{id}
	</select>
	
	<!-- 删除 -->
	<delete id="delete" parameterType="int">
		delete from user where id=#{id}
	</delete>
	
	<!-- 查找所有用户 -->
	
	<select id="findAll" resultType="user">
	       select * from user
	</select>
	
	<resultMap type="java.util.Map" id="result_person">
	    <result property="ID" column="id" />
	    <result property="NAME" column="name"/>
	    <result property="AGE" column="age"></result>
	</resultMap>
        <select id="checkLogin" parameterType="java.util.Map" resultMap="result_person">
                select id,name,age from user where username=#{username} and password=#{password}
        </select>
	
</mapper>